package com.example.verticle;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.*;

public class TestVerticle extends AbstractVerticle {

    @Override
    public void start() throws Exception {
        HttpClientOptions options = new HttpClientOptions();
        options.setDefaultHost("localhost");
        options.setDefaultPort(8080);
        HttpClient client = vertx.createHttpClient(options);

        for (int i = 0; i < 100; i++) {
            client.request(HttpMethod.GET, "/", ar1 -> {
                if (ar1.succeeded()) {
                    HttpClientRequest request = ar1.result();
                    request.send(ar2 -> {
                        if (ar2.succeeded()) {
                            HttpClientResponse response = ar2.result();
                            System.out.println("Received response with status code " + response.statusCode());
                        }
                    });
                }
            });
        }
    }
}
